CheckBox.inherit("Control");

function CheckBox(node){
	this.Control(node);
		
	this.submitState=this.properties.getObject("checked");
	this.checkBoxForm=document.getElementById(this.properties.getString("clientId"));
	this.text=this.properties.getString("text");
}



CheckBox.prototype.isChecked=function () {
		return this.checkBoxForm.checked;
	}

CheckBox.prototype.setChecked=function (value) {
		this.checkBoxForm.checked=value;
	}

CheckBox.prototype.clear=function (){
		if (!this.checkBoxForm.disabled) {
			this.setChecked(false);
		}
	}

CheckBox.prototype.toString=function () {
		//return this.checkBoxForm.checked?this.text:"";
		return this.submitState?this.text:"";
	}


CheckBox.prototype.getEventHandler=function () {
		if (!this.eventHandler){
			this.eventHandler=new EventHandler(this, this.checkBoxForm);
		}
		return this.eventHandler;
}
	

	
/*CheckBox.build = function(element) {
    var submitState = CheckBox.properties.getAttribute(element, "coreimsee:checked");
    var controlId = CheckBox.getAttribute(element, "coreimsee:clientId");  
    var text = CheckBox.getAttribute(element, "coreimsee:text");  
    var checkbox =  new CheckBox(controlId, text, submitState);           
    checkbox.element = element;
    return checkbox;
}

CheckBox.getAttribute = function(element, attr) {
    return eval(element.getAttribute(attr));
}*/
